<?php echo $this->render('/public/header');?>
<div class="col-lg-12" id="main">

    <div class="layui-box layui-upload-button">
<form target="layui-upload-iframe" method="post" key="set-mine" enctype="multipart/form-data" action="/sell/shipment_import"><input type="file" name="print" id="print" lay-type="file" lay-title="出货批量上传" class="layui-upload-file"></form>
<span class="layui-upload-icon"><i class="layui-icon"></i>出货批量上传</span>
</div>

  <a href="/sell/shipment_add" class="btn btn-success" style="width:150px">添加出货记录</a>
    <br/>
    <br/>
    <table class="table table-borderd">
        <thead>
            <tr>
                <th>id</th>
                <th>date</th>
                <th>invoice</th>
                <th>pi</th>
                <th>货运状态</th>
                <th>预测到达日期</th>
                <th>客户编号</th>
                <th>客户名字</th>
                <th>运货方式</th>
                <th>快递公司</th>
                <th>目的地</th>
                <th>实际送达时间</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
        </thead>
        <?php if($this->params['list']){?>
        <?php foreach ($this->params['list'] as $k => $v) { ?>
        <tr>
            <td><?php echo $v['id'];?></td>	
            <td><?php echo $v['date'];?></td>	
            <td><?php echo $v['invoice'];?></td>
            <td><?php echo $v['pi'];?></td>		
            <td>
<?php 
if($v['status']==1)
    echo '生产中';
if($v['status']==2)
    echo '生产完';
if($v['status']==3)
    echo '仓库';
if($v['status']==4)
    echo '空/海上';
if($v['status']==5)
    echo '到港';
if($v['status']==6)
    echo '派送中';
if($v['status']==7)
    echo '已送达';
?>
            </td>	
            <td><?php echo $v['predict_date'];?></td>	
            <td><?php echo $v['customer_num'];?></td>	
            <td><?php echo $v['customer_name'];?></td>	
            <td>
<?php 
if($v['ship_type']==1)
    echo '海运';
if($v['ship_type']==2)
    echo '空运';
if($v['ship_type']==3)
    echo '快递';
?>
            </td>	
            <td>
<?php 
foreach ($this->params['express_list'] as $k2 => $v2) { 
    if($v2['id']==$v['express_id']){echo $v2['name'];}
} 
?>	
            </td>	
            <td><?php echo $v['address'];?></td>
            <td><?php echo $v['real_date'];?></td>	
            <td><?php echo $v['remark'];?></td>
            <td>
                <a class="btn btn-success" href="/sell/shipment_edit?id=<?php echo $v['id'];?>">编辑</a>
            </td>        
        </tr>
        <?php } ?>
        <?php } ?>
    </table>
    <div id="page" style="display: inline-block;"></div>
    <div style="display: inline-block;">共<?php echo $this->params['page']['total'];?>条记录</div>
</div>
<script type="text/javascript">
layui.laypage({
cont: 'page' 
    ,pages: <?php echo $this->params['page']['page'];?>,
    curr:<?php echo $this->params['page']['curr'];?>,
    skin: '#5FB878'
    ,skip: true 
    ,jump: function(obj, first){
        if(!first){
            if(window.location.search)
            {
                window.location.href = "<?php echo $this->params['page']['url'];?>&p="+obj.curr;
            }
            else
            {
                window.location.href = "<?php echo $this->params['page']['url'];?>?p="+obj.curr;
            }

        }
    }
});

layui.upload({
    url:'/sell/shipment_import',
    before:function(){
        layer.load(1,{shade:[0.1,'#fff']});
    },
    success:function(res){
        layer.closeAll();
        if(res.code==1){
            layer.confirm(res.msg,{},function(){
                window.location.reload();
            })
        }
        else
        {
            layer.alert(res.msg);
        };
    }
})
</script>
<?php echo $this->render('/public/footer');?>
